public class FoxMakingDice {
	public long theCount(int N, int K) {
		long res = 0;
		for (int sum = K; sum <= 2 * N - 1; sum++) {
			long ways = 0;
			for (int first = 1; first <= N; first++) {
				int second = sum - first;
				if (second > 0 && first > second)
					ways++;
			}
			long cur = ways * (ways - 1) * (ways - 2) / 3;
			res += cur;
		}
		return res;
	}


// BEGIN CUT HERE
	public static void main(String[] args) {
		if (args.length == 0) {
			FoxMakingDiceHarness.run_test(-1);
		} else {
			for (int i=0; i<args.length; ++i)
				FoxMakingDiceHarness.run_test(Integer.valueOf(args[i]));
		}
	}
// END CUT HERE
}

// BEGIN CUT HERE
class FoxMakingDiceHarness {
	public static void run_test(int casenum) {
		if (casenum != -1) {
			if (runTestCase(casenum) == -1)
				System.err.println("Illegal input! Test case " + casenum + " does not exist.");
			return;
		}
		
		int correct = 0, total = 0;
		for (int i=0;; ++i) {
			int x = runTestCase(i);
			if (x == -1) {
				if (i >= 100) break;
				continue;
			}
			correct += x;
			++total;
		}
		
		if (total == 0) {
			System.err.println("No test cases run.");
		} else if (correct < total) {
			System.err.println("Some cases FAILED (passed " + correct + " of " + total + ").");
		} else {
			System.err.println("All " + total + " tests passed!");
		}
	}
	
	static boolean compareOutput(long expected, long result) { return expected == result; }
	static String formatResult(long res) {
		return String.format("%d", res);
	}
	
	static int verifyCase(int casenum, long expected, long received) { 
		System.err.print("Example " + casenum + "... ");
		if (compareOutput(expected, received)) {
			System.err.println("PASSED");
			return 1;
		} else {
			System.err.println("FAILED");
			System.err.println("    Expected: " + formatResult(expected)); 
			System.err.println("    Received: " + formatResult(received)); 
			return 0;
		}
	}

	static int runTestCase(int casenum) {
		switch(casenum) {
		case 0: {
			int N                     = 6;
			int K                     = 7;
			long expected__           = 2L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}
		case 1: {
			int N                     = 5;
			int K                     = 7;
			long expected__           = 0L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}
		case 2: {
			int N                     = 1000;
			int K                     = 1;
			long expected__           = 20625666000L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}
		case 3: {
			int N                     = 456;
			int K                     = 123;
			long expected__           = 879075732L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}
		case 4: {
			int N                     = 913;
			int K                     = 1014;
			long expected__           = 4506149340L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}

		// custom cases

/*      case 5: {
			int N                     = ;
			int K                     = ;
			long expected__           = L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}*/
/*      case 6: {
			int N                     = ;
			int K                     = ;
			long expected__           = L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}*/
/*      case 7: {
			int N                     = ;
			int K                     = ;
			long expected__           = L;

			return verifyCase(casenum, expected__, new FoxMakingDice().theCount(N, K));
		}*/
		default:
			return -1;
		}
	}
}

// END CUT HERE
